import test from 'tape';
import { put, call } from 'redux-saga/effects';
import { incrementAsync, delay } from '../saga/saga';

test('incrementAsync Saga test', (assert) => {
    const gen = incrementAsync();
    assert.deepEqual(gen.next(), { done: false, value: call(delay, 100) }, 'counter Saga must call delay(1000)');
    assert.deepEqual(gen.next().value, put({ type: 'INCREMENT' }), 'counter Saga must dispatch an INCREMENT action');
    assert.deepEqual(gen.next().value, undefined, 'counter Saga must be done');
    assert.end()
})